<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <title>服务号-所有用户列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">

</head>
<body>
<section class="content" id="list">

    <div style="height: 25px;margin-bottom: 10px;">
        <div class="pull-left" style="width:120px;">
            <select v-model="searchParams.subscribe" class="form-control"
                    style="height:25px;font-size:12px;line-height:25px;padding-top:0px;padding-bottom:0px;padding-left:6px;">
                <option v-for="(item,i) in typeList" v-bind:value="item.value">{{item.name}}</option>
            </select>
        </div>
        <input class="form-control pull-left input-sm" type="text" placeholder="客户电话"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.customerTel"/>
        <input class="form-control pull-left input-sm" type="text" placeholder="所属销售"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.salerName"/>
        <input class="form-control pull-left input-sm" type="text" placeholder="所属销售电话"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.salerTel"/>
        <button type="button" class="btn oaBtn btn-sm" @click="search" style="margin-left: 10px;">
            查询
        </button>
        <!--<button type="button" v-if="" class="btn oaBtn pull-right btn-sm" style="margin-right: 20px"-->
                <!--@click="gotoDetail(0,'edit',1)"/>-->
        <!--导出</button>-->
        <div class="clearfix"></div>
        <!-- /.box-tools -->
    </div>

    <div class="box-body no-padding iframeH2" style="overflow: auto;" id="scrollDiv">
        <div class="box-body no-padding" style="overflow: auto;background: #fff;">
            <table class="table table-hover table-bordered" cellspacing= "0">
                <thead>
                <tr>
                    <th style="width: 30px;text-align: center">用户昵称</th>
                    <th style="width: 10px;text-align: center">用户电话</th>
                    <th style="width: 30px;text-align: center">用户所在地</th>
                    <th style="width: 30px;text-align: center">用户关注状态</th>
                    <th style="width: 30px;text-align: center">用户关注时间</th>
                    <th style="width: 30px;text-align: center">所属销售</th>
                    <th style="width: 30px;text-align: center">所属销售电话</th>
                </tr>
                </thead>
                <tbody>
                <tr v-for="(item, i) in user_list">
                    <td style="text-align: center">{{item.nickName}}</td>
                    <td style="text-align: center">{{item.customerTel}}</td>
                    <td style="text-align: center">{{item.province}} {{item.city}}</td>
                    <td v-if="item.subscribe == 1" style="text-align: center">已关注</td>
                    <td v-else-if="item.subscribe == 0" style="text-align: center">未关注</td>
                    <td style="text-align: center">{{item.subscribeTime}}</td>
                    <td style="text-align: center">{{item.salerName}}</td>
                    <td style="text-align: center">{{item.salerTel}}</td>
                </tr>
                </tbody>
            </table>
            <div class="oa-pager text-center" style="margin-top: 5px;">
                共
                <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
                <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
                <span class="oa-pager-button" id="first">首页</span>
                <span class="oa-pager-button" id="prev">上一页</span>
                <span class="oa-pager-button" id="next">下一页</span>
                <span class="oa-pager-button" id="last">尾页</span>
            </div>
        </div>
    </div>
    <!-- /.box-body -->
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">

    var app = new Vue({
        el: '#list',
        data: {
            searchParams: {
                subscribe:"",
                customerTel:"",
                salerName:"",
                salerTel:"",
            },
            user_list:"",
            typeList:[
                {name:"当前关注状态",value:""},
                {name:"已关注",value:1},
                {name:"未关注",value:0}
            ]
        },
        methods: {
            search: function () {
                $.extend($.wyui.page.queryParams, this.searchParams);
                $.wyui.page.getByPage();
            },
            refresh: function () {
                $.wyui.page.getByPage();
            }
        },

        mounted: function () {
        }
    });

    $.wyui.page.dataUrl = server.ip + "/wechatServiceAccountUser/getUserList.json";
    $.extend($.wyui.page.queryParams, app.searchParams);
    $.wyui.page.getByPage_callback = function (records) {
        app.user_list = records;
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        for(var i=0;i<list.length;i++){
            app.list.push(list[i]);
        }
        isLoad=true;
    };
</script>
<script>
    /************************滚动加载******************************/
    var divscroll = document.getElementById('scrollDiv');
    function divScroll() {
        var wholeHeight = divscroll.scrollHeight;
        var scrollTop = divscroll.scrollTop;
        var divHeight = divscroll.clientHeight;
        console.log(scrollTop + divHeight,wholeHeight)
        if(scrollTop + divHeight >= wholeHeight-2){
            if(isLoad){
                isLoad=false;
                setTimeout( $.wyui.page.getByPage("scroll"),1000);

            }
            //这里写动态加载的逻辑，比如Ajax请求后端返回下一个页面的内容
        }

    }
    divscroll.onscroll = divScroll;
</script>

</body>
</html>